<?php

namespace app\api\controller\driver;

use app\common\controller\Api;
use app\common\service\driver\OrderService;
use think\Validate;

/**
 * 司机端-统计中心接口
 * @ApiWeigh (85)
 */
class OrderStatistics extends Api
{
    protected $noNeedLogin = [''];
    protected $noNeedRight = ['*'];

    public function _initialize()
    {
        parent::_initialize();
    }


    /**
     * 统计
     *
     * @ApiMethod (POST)
     * @ApiParams (name="type", type="integer", required=true, description="类型:1=今日,2=本周,3=本月,4=今年 不传值默认1")
     * @ApiParams (name="start_time", type="string", required=true, description="开始时间 2024-07-11")
     * @ApiParams (name="end_time", type="string", required=true, description="结束时间 2024-07-11")
     * @ApiReturnParams (name=data,type="object",description=要返回的数据)
     * @ApiReturn ({"code": 1,"msg": "统计","time": "1694660842","data": {"today_order_amount": "收入流水","today_order_num": "接单数"}})
     **/
    public function list()
    {
        $type = $this->request->post('type');
        $start_time = $this->request->post('start_time');
        $end_time = $this->request->post('end_time');
        $user = $this->auth->getUser();
        $result = OrderService::statistics_driver($type, $start_time,$end_time,$user);
        $this->success('统计', $result);
    }

}
